function Bike(part,birimg,biimg,beimg){
    this.part=part;
    this.birimg=birimg;
    this.biimg=biimg;
    this.speed=3;//防止误操作
    this.setSpeed=function(speed){
        this.speed=speed;
//        this.timer=setInterval(function(){
//
//        },40);
//        clearInterval(this.timer);
    }
//
    this.moveAhead = function(){
        var left=$main.css('left');
        $main.css('left',(parseInt(left.substring(0,left.length-2))+this.speed)+"px");
    };
    this.getLeft = function(){
        var left=$main.css('left');
        return parseInt(left.substring(0,left.length-2));
    }
    this.setPosition=function(x,y){
        $main.css({"top":y+"px","left":x+"px"})
    };
    var $main=$("<div id='main'></div>");
    var $ren=$("<div class='biker'></div>");
    $ren.css("background","url("+birimg+")");
    var $motuo=$("<div class='bike'></div>");
    $motuo.css("background-image","url("+biimg+")");
    var $luntai1=$("<div class='lwhell'></div>");
    $luntai1.css("background-image","url("+beimg+")");
    var $luntai2=$("<div class='rwhell'></div>");
    $luntai2.css("background-image","url("+beimg+")");


    $main.append($ren);
    $main.append($motuo);
    $main.append($luntai1);
    $main.append($luntai2);
    this.part.append($main);


}
function FarCtrl(part,maxfar){
        var $runfar=$("<button class='runfar'></button>");
        part.append($runfar);
        this.setfar=function(lef){
          $runfar.html("已走路程："+lef+"&nbsp&nbsp&nbsp剩余路程："+parseInt(maxfar-lef));
        }
    }
    function TimeCtrl(part){
        var $runtime=$("<button class='runtime'></button>");
          part.append($runtime);
        var i=1;
        this.settime=function(){ 
          window.setInterval(function(){
            $runtime.html("时间："+(i++));
            return i;
          },1000);
          $runtime.html("时间："+i);
      }
    }